# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :create_app.py
# @Time      :2022/6/28 14:08
# @Author    :吕华龙

from flask import Flask
from settings.config import DevConfig
from models.model import db
from flask_cors import CORS
from apps.user import user_bp
from apps.news import news_bp


def create_app(config):
    app = Flask(__name__)
    # 从对象中加载配置文件
    app.config.from_object(config)
    # 初始化db
    db.init_app(app)
    # 跨域
    cors = CORS(app)
    # 注册蓝图
    app.register_blueprint(user_bp)
    app.register_blueprint(news_bp)
    return app


# app = create_app(DevConfig)
